<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" isELIgnored="false" import="java.util.*"
	pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<html>
<head>
<%@ include file="/include/header.jsp"%>
<title><s:text name="userInfSet.titleT"></s:text></title>
<link href="<%=request.getContextPath() %>/css/um/default.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/css/um/milk.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/css/um/register.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jsFile/easyui/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jsFile/easyui/themes/icon.css"/>

<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/easyui/jquery.easyui.extend.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/easyui/jQuery.Json.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/kindEditor/kindeditor-min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath() %>/jsFile/formvalidator/style/validator.css"></link>
<script src="<%=request.getContextPath() %>/jsFile/formvalidator/formValidator-4.0.1.js" type="text/javascript" charset="UTF-8"></script>
<script src="<%=request.getContextPath() %>/jsFile/formvalidator/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<!--  
<script src="<%=request.getContextPath() %>/jsFile/formvalidator/DateTimeMask.js" type="text/javascript" charset="UTF-8"></script>
-->
<%-- <script type="text/javascript" src="${pageContext.request.contextPath}/fare/js/show.js"></script>--%>

<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">

<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<%=request.getContextPath() %>/jsFile/wait/js/wait.js"></script>	
<script src="<%=request.getContextPath()%>/js/koala/Koala.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/js/koala/Validate.js" type="text/javascript"></script>
<style type="text/css">
#select_group{
	width:190px;
	
}

</style>

<script  type="text/javascript">
 
$(document).ready(function() {
	$("#select_dpmt").ligerComboBox(); 
	//$("#select_group").ligerComboBox();
	
});

function reload(){
	window.location.reload();
}



/**
 * 表单验证
 */
 function validator(){
 	$.formValidator.initConfig({formID:"signupform",debug:false,Submitonce:true,
		submitAfterAjaxPrompt : document.getElementById("register.validated").value,
		onSuccess:function(){//验证成功后会出现提交过久的问题，所以出现等待状态图片
			FDCWait.show();
			return true;
		}
	});
	$("#email").formValidator({onShow:"",onFocus:document.getElementById("register.emailCheck").value,onCorrect:""})
	.inputValidator({min:6,max:100,onError:document.getElementById("register.lenghtEr").value})
	.regexValidator({regExp:"^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$",onError:document.getElementById("register.emailFormatEr").value})
	
	$("#user_phone").formValidator({onShow:"",empty:true,onFocus:document.getElementById("register.qqFormate").value,onCorrect:""})
	.regexValidator({regExp:["tel","mobile"],dataType:"enum",onError:document.getElementById("register.formatEr").value});
	
	$("#user_qq").formValidator({empty:true,onShow:"",onFocus:document.getElementById("register.qqFormate").value,onCorrect:""})
	.inputValidator({min:5,max:10,onError:document.getElementById("register.qqLengthForm").value})
	.regexValidator({regExp:"qq",dataType:"enum",onError:document.getElementById("register.formatEr").value});
}
 
 
 
$(document).ready(function(){
	var successAlert=document.getElementById("share.success").value;
	var sureChangeAlert=document.getElementById("userInfSet.sureInforSet").value;
	var failureAlert=document.getElementById("share.fail").value;
	var changeEmailAlert=document.getElementById("userInfSet.sureInforEmailA").value;
	validator();
	var status = "${status}";
	if(status=='success'){
		//$.ligerDialog.success('设置成功!\n您更改了个人信息，请重新登录');
		alert(successAlert+"\n"+sureChangeAlert);
		window.location.href="<%=request.getContextPath()%>/j_spring_security_logout";
	}
	if(status=='error'){
		//$.ligerDialog.error('设置失败!');
		alert(failureAlert);
	}
	if(status=='emailexcept'){
		//$.ligerDialog.error('邮箱已注册，请修改!');
		alert(changeEmailAlert);
	}
	
	
	
});


function setPassword(id){
	var changePassAlert=document.getElementById("userInfSet.changePassA").value;
	var height = 220;
	 var width = 700;
	 var url = '<%=request.getContextPath() %>/userAction!setPasswordInput.action?userInfo.userId='+id;
     $.ligerDialog.open({ height: height, url: url, width: width,title:changePassAlert });
}


//重置清空tip
function tipReset(){
	$("#user_nameTip").html("");
	$("#emailTip").html("");
	$("#user_companyTip").html("");
	$("#user_phoneTip").html("");
	$("#user_qqTip").html("");
	//$("#select_group").ligerGetComboBoxManager().setValue(${userInfo.group});
	//$("#select_group")[0].selectedIndex=0;
	//$("#select_group").val("0000");
}
Koala.changepassword = function (){
	var cancel=document.getElementById("share.cancel").value;
	var sure=document.getElementById("share.sure").value;
	var changePassAlert=document.getElementById("userInfSet.changePassA").value;
    $(document).bind('keydown.changepassword', function (e)
    {
        if (e.keyCode == 13)
        {
            doChangePassword();
        }
    });

    var changepasswordPanel = null;
    if (!window.changePasswordWin)
    {
    	changepasswordPanel = $("#changepasswordPanel");

        window.changePasswordWin = $.ligerDialog.open({
            width: 400,
            height: 190, 
            top: 200,
            isResize: true,
            title: changePassAlert,
            target: changepasswordPanel,
            buttons: [
            { text: sure, onclick: function ()
            {
                doChangePassword();
            }
            },
            { text: cancel, onclick: function ()
            {
                window.changePasswordWin.hide();
                $(document).unbind('keydown.changepassword');
            }
            }
            ]
        });
    }
    else
    {
        window.changePasswordWin.show();
    }

    function doChangePassword(){
    	var confirmA=document.getElementById("register.inputConfirmPass").value;
    	var checkPassA=document.getElementById("register.passCorrect").value;
    	var inputNewA=document.getElementById("userInfSet.inputNewPass").value;
    	var checkPassFortA=document.getElementById("register.passFormate").value;
    	var checkPassEnptyA=document.getElementById("userInfSet.thePassEmpty").value;
    	var checkPassLengthA=document.getElementById("userInfSet.thePassLength").value;
    	var successAlert=document.getElementById("share.success").value;
    	var theOriPassErrorA=document.getElementById("userInfSet.theOriPassError").value;
    	
        var OldPassword = $("#oldPassword").val();
        var LoginPassword = $("#newPassword").val();
        var confirmPasswords=$("#confirmPassword").val();
        if(OldPassword.length==0){
        	$.ligerDialog.warn(checkPassEnptyA);
        }else if(LoginPassword.length==0){
        	$.ligerDialog.warn(inputNewA);
        }else if(!ispassword(LoginPassword)){
        	$.ligerDialog.warn(checkPassFortA);
        }else if(LoginPassword.length<6 || LoginPassword.length>16){
        	$.ligerDialog.warn(checkPassLengthA);
        }else if(confirmPasswords.length==0){
        	$.ligerDialog.warn(confirmA);
        }else if(LoginPassword != confirmPasswords){
        	$.ligerDialog.warn(checkPassA);
        }else{
	        var data = "oldPassword=" + OldPassword + "&userPassword=" + LoginPassword;
	        //验证
	        var form = document.forms[0];
	        if(!Validator.Validate(form,3))return;
	        $.ajax({
	        	method:"post",
	        	url:"<%=request.getContextPath()%>/auth/User/updatePassword.koala",
	        	data:data,
	        	success:function(msg) {
	        		if (msg.result == "success") {
	        			$.ligerDialog.alert(successAlert);
	        			changePasswordWin.hidden();
	        		} else if (msg.result == "failure") {
	        			$.ligerDialog.alert(theOriPassErrorA);
	        		}else{
	        			$.ligerDialog.alert(msg.result);
	        		}
	        	}
	        });
        }
    }

};
function ispassword(LoginPassword){
	var reg1=/^[0-9a-zA-Z]*$/g;
	if(LoginPassword.match(reg1)){
		return true;
		}
	return false;
}
 </script>
</head>
<body id="aboutus">
<%@ include file="/include/home/home_header.jsp" %>
<jsp:include page="/pages/system/feedback/feedback.jsp"></jsp:include>
<div class="main main_max minhgt450">
	<div class="sideBar">
	<div class="box">
		<div class="location"><s:text name="share.currentL"/>：<s:text name="share.personC"/> &gt; <s:text name="userInfSet.titleInforSet"/></div>
	</div>
	</div>
	<div class="form_table_tltle"><s:text name="userInfSet.titleInforSet"/></div>
             <ul id="errorlist"></ul>
               <form  action="<%=request.getContextPath() %>/userAction!updateUserInfo.action"  id="signupform" method="post">
               	 <input type="hidden" name="userInfo.userId" value="${userInfo.userId }"/>
               	 <input type="hidden" name="userInfo.accoutId" value="${userInfo.accoutId }"/>
               	 <input type="hidden" name="oldEmail" value="${oldEmail}"/>
                <input type="hidden" name="userInfo.sourceId" value="${userInfo.sourceId }"/> 
                 <input type="hidden" name="userInfo.hbaseKey" value="${userInfo.hbaseKey }"/> 
               	<input type="hidden" name="userInfo.loginId" value="${userInfo.loginId }"/> 
               	 
               	 <!-- 国际化信息		 -->
 				 <input type="hidden" id="register.validated" value="<s:text name="register.validated"/>" /> 
               	 <input type="hidden" id="register.emailCheck" value="<s:text name="register.emailCheck"/>" />
               	 <input type="hidden" id="register.lenghtEr" value="<s:text name="register.lenghtEr"/>" />
               	 <input type="hidden" id="register.emailFormatEr" value="<s:text name="register.emailFormatEr"/>" />
               	 <input type="hidden" id="register.qqFormate" value="<s:text name="register.qqFormate"/>" />
               	 <input type="hidden" id="register.formatEr" value="<s:text name="register.formatEr"/>" />
               	 <input type="hidden" id="register.qqLengthForm" value="<s:text name="register.qqLengthForm"/>" />
               	 <input type="hidden" id="share.fail" value="<s:text name="share.fail"/>" />
               	 <input type="hidden" id="share.success" value="<s:text name="share.success"/>" />
               	 <input type="hidden" id="userInfSet.sureInforSet" value="<s:text name="userInfSet.sureInforSet"/>" />
               	 <input type="hidden" id="userInfSet.sureInforEmailA" value="<s:text name="userInfSet.sureInforEmailA"/>" />
               	 <input type="hidden" id="userInfSet.changePassA" value="<s:text name="userInfSet.changePassA"/>" />
               	 <input type="hidden" id="share.cancel" value="<s:text name="share.cancel"/>" />
               	 <input type="hidden" id="share.sure" value="<s:text name="share.sure"/>" />
               	 <input type="hidden" id="register.inputConfirmPass" value="<s:text name="register.inputConfirmPass"/>" />
               	 <input type="hidden" id="register.passCorrect" value="<s:text name="register.passCorrect"/>" />
               	 <input type="hidden" id="userInfSet.inputNewPass" value="<s:text name="userInfSet.inputNewPass"/>" />
               	 <input type="hidden" id="register.passFormate" value="<s:text name="register.passFormate"/>" />
               	 <input type="hidden" id="userInfSet.thePassEmpty" value="<s:text name="userInfSet.thePassEmpty"/>" />
               	 <input type="hidden" id="userInfSet.thePassLength" value="<s:text name="userInfSet.thePassLength"/>" />
               	 <input type="hidden" id="userInfSet.theOriPassError" value="<s:text name="userInfSet.theOriPassError"/>" />
               	 
               	 
                 <table cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_table">
                       <tbody>
                     <tr>
                         <td align="right" class="left"  valign="middle"> <s:text name="register.username"/><span class="req">*</span>&nbsp;</td>
                         <td>
                           <input readonly="readonly" class="input_205 input_txt cname" id="user_name" maxlength="20" minlength="3"  name="userInfo.userName" value="${userInfo.userName }" size="20"  type="text"/>
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                     <tr>
                     	<td colspan="3" style="height:35px;text-align:left;">
                     		<!-- <input type="button" value="" class="btn10" onclick="Koala.changepassword()"/> -->
                     		<input type="button" value="" style="width:120PX" class="<s:text name ="forms.btn10"/>" onclick="Koala.changepassword()"/>
                     	</td>
                     </tr>
                      <tr>
                         <td align="right" valign="middle" class="left" width="80">Email<span class="req">*</span>&nbsp;</td>
                         <td>
                           <input class="input_205 input_txt" id="email" value="${userInfo.email }"  name="userInfo.email" size="30"   type="text"/>
                         </td>
                         <td><div id="emailTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                     <tr>
                         <td align="right" class="left" valign="middle"><s:text name="register.company"/>&nbsp;</td>
                         <td>
                            <input readonly="readonly" class="input_205 input_txt" id="user_company" value="${userInfo.company }"  name="userInfo.company" size="30" type="text" />
                          </td>
                         <td><div id="user_companyTip"  class="userTip_div" style="width:250px"></div></td>
                     </tr>
                     <tr>
                         <td align="right" class="left" valign="middle"><s:text name="register.telephoneNumber"/>&nbsp;</td>
                         <td>
                           <input class="input_205 input_txt" id="user_phone" value="${userInfo.phone }"  name="userInfo.phone" size="30" type="text"/>
                          </td>
                         <td><div id="user_phoneTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                     <tr>
                         <td align="right" class="left" valign="middle">QQ&nbsp;</td>
                         <td>
                           <input class="input_205 input_txt" maxlength="10" minlength="5" value="${userInfo.qq }"  id="user_qq"  name="userInfo.qq" size="30" type="text"/>
                          </td>
                         <td><div id="user_qqTip"  class="userTip_div" style="width:250px"></div></td>
                     </tr>
                     <tr>
                         <td align="right" class="left" valign="middle"><s:text name="register.userGroups"/>&nbsp;</td>
                         <td>
                           	<select name="userInfo.group" id="select_group" disabled="disabled">
								<c:forEach var="bean" items="${roleList}" varStatus="stat">
									<option value="${bean.id}" <c:if test="${bean.id==userInfo.groupId }">selected='selected'</c:if>>${bean.name}</option>
								</c:forEach>
							</select>  
                          </td>
                         <td class="status"></td>
                     </tr>
                     <tr >
                         <td colspan="3"  style="text-align:center;height:35px;" >
                         	<input id="button" value="" class="<s:text name ="forms.btn05"/>" type="submit" />
							<!--
                 			<input type="button" value="" onclick="input()" class="btn03"/>
							-->
							<input type="reset" value="" onclick="tipReset()" class="<s:text name ="forms.btn03"/>"/>
                         </td>
                     </tr>
                 </tbody></table>
				</form>        
			</div>
         <div class="register_content_bottom"></div>
       <form id="changepasswordPanel" style="display:none;">
		<table cellpadding="0" cellspacing="0" class="form2column" >
			<tr>
				<td class="label"><s:text name="userInfSet.oldPass"/>:</td>
				<td class="content">
					<input name="oldPassword" type="password" id="oldPassword" class="input-common" dataType="Require" />
				</td>
			</tr>
			<tr>
				<td class="label"><s:text name="userInfSet.newPass"/>:</td>
				<td class="content">
					<input name="newPassword" type="password" id="newPassword" class="input-common" dataType="Require" maxLength="16" />
				</td>
			</tr>
			<tr>
				<td class="label"><s:text name="register.confirmPassword"/>:</td>
				<td class="content">
					<input name="confirmPassword" type="password" id="confirmPassword" class="input-common" dataType="Require" maxLength="16" />
				</td>
			</tr>
		</table>
	</form>
		 <%@ include file="/include/home/home_footer.jsp" %> 
		 <br><br><br><br><br><br><br><br><br>
<jsp:include page="../../inc/footer2.jsp"></jsp:include> 
</body>
</html>